<template>
	<view class="wrap">
		<view class="input_box">
			<input type="text" v-model="info.characters" placeholder="请设置下单的时候字印" />
		</view>
		<view class="btn_box" @click="btnHandler">
			确认提交
		</view>
	</view>
</template>

<script>
	import {
		wordingSave,
		get_wording
	} from "@/api/new_api.js"
	import {
		debounceImmediate
	} from "@/utils/validate"
	export default {
		data() {
			return {
				info: {
					id: '',
					characters: ''
				},
			}
		},
		onLoad() {
			this.get_wording()
		},
		methods: {
			btnHandler: debounceImmediate(function() {
				let that=this
				console.log("执行");
				// if (!this.info.characters) return this.$util.Tips({
				// 	title: '请输入下单字印'
				// })
				wordingSave(this.info).then((res) => {
					this.$util.Tips({
						title: res.msg,
						success(){
							that.get_wording()
						}
					})

				})
			}, 1000),
			get_wording() {
				get_wording().then((res) => {
					const data = res.data.wording
					if (data && data.id) {
						this.info.characters = data.characters
						this.info.id = data.id
					}

				})
			}
		}
	}
</script>

<style lang="scss" scoped>
	.wrap {
		padding: 30rpx 25rpx;

		.input_box {
			height: 100rpx;
			border-radius: 12rpx;
			background: rgba(255, 255, 255, 1);
			padding: 28rpx 34rpx;
			margin-bottom: 30rpx;

			input {
				font-size: 30rpx;
			}
		}

		.btn_box {
			width: 690rpx;
			height: 90rpx;
			line-height: 90rpx;
			text-align: center;
			font-size: 30rpx;
			font-weight: 500;
			color: #fff;
			border-radius: 14rpx;
			background: rgba(0, 0, 0, 1);
		}
	}
</style>